<!DOCTYPE html>
<html>

<head>

    {include file="Public:header"}
    <style>
        .radio-inline input[type=radio] {
            margin-top: 4px;
        }
    </style>
</head>

<body style="color:#333;padding:3px;overflow-x: auto;">
<!-- 标题 -->
<div class="page-heade">
    <h1 class="title_color">所属网点订单汇总表</h1>
</div>
<!-- 标题 -->
<div class="row-margin-top">
    <form action="" class="form-inline">
        <table class="row-margin-top tab-content table-bordered  table text-left" border="1">
            <tr>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">业务员：</label></td>
                <td><input type="text" class="form-control" name="ywy" value="{$ywy}" id="empName"></td>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">网店名称：</label></td>
                <td><input type="text" class="form-control" name="wdmc" value="{$wdmc}" id="wangDianName"></td>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">经销商名称：</label></td>
                <td><input type="text" class="form-control" name="jxsmc" value="{$jxsmc}" id="jinXiaoShanName"></td>
            </tr>
            <tr>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">所属分区(网点)：</label></td>
                <td><input type="text" class="form-control" name="zoning" value="{$zoning}" id="strArea"></td>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">所属省份(网点)：</label></td>
                <td><input type="text" class="form-control" name="provice" value="{$provice}" id="strProvince"></td>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">所属城市(网点)：</label></td>
                <td><input type="text" class="form-control" name="city" value="{$city}" id="strCity"></td>
            </tr>
            <tr>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">配送类型：</label></td>
                <td>
                    <select name="pslx" id="peiSongType" class="form-control">
                        <option value="">所有</option>
                        <option value="1" {if $pslx==1}selected{/if}>经销商</option>
                    </select>
                </td>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">订单日期：</label></td>
                <td colspan="3">
                    <div class="form-group">
                        <input type="text" id="start" class="form-control layer-date "
                               style="display: inline-block;min-width: 120px;width: 120px" name="start"
                               value="{$start}">
                    </div>
                    <div class="form-group">
                        至
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control layer-date"
                               style="display: inline-block;min-width: 120px;width: 120px" id="end" name="end"
                               value="{$end}">
                    </div>
                </td>
            </tr>
            <tr>
                <td style="min-width: 140px;width: 140px"><label for="" class="form-label">产品维度：</label></td>
                <td colspan="5">
                    <div class="form-group">
                        <label class="radio-inline">
                            <input type="radio" checked name="cpwd" id="inons21" value="1">品牌
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="cpwd" id="inons22" value="2">品类
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="cpwd" id="inons23" value="3">系列
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="cpwd" id="inons24" value="4">SKU
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="cpwd" id="inons25" value="5">单品
                        </label>
                    </div>
                    <br>
                    <div class="padding-10">

                        <div class="col-xs-4">
                            <div class="input-group" id="">
                                <input type="text" placeholder="请输入关键字或空格查询" class="form-control inputremindPeple"
                                       id="cp" value="{:isset($supply)?$supply.jxs:''}">
                                <div class="input-group-btn">
                                    <button type="button" class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown">
                                        <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-2">
                            <button class="btn btn-primary btn-sm" type="button" id="select_brand">选择</button>
                            <!--<button class="btn btn-primary btn-sm clear_net"  type="button" >清空</button>-->
                        </div>
                    </div>
                    <div id="chanPin_selectIds" name="chanPin_selectIds" class="duoxuan" style="clear:both;">
                        {volist name="cpwd2" id="row" key="k"}
                        <span class="ren">{$cpwd3[$k-1]}<span class="close">×</span><input type="hidden" name="cpwd2[]" value="{$row}"><input type="hidden" name="cpwd3[]" value="{$cpwd3[$k-1]}"></span>
                        {/volist}
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="6" class="text-center">
                    <button class="btn btn-info query" type="submit" onclick="searchMethod(0)">查询</button>
                    <button class="btn btn-info emptyIf" type="button">清空查询条件</button>
                    <button class="btn btn-info LendExcel" type="button">导出Excel</button>
                </td>
            </tr>
        </table>

        <table class="table row-margin-top table-bordered table-hover text-center bud_hei">
            <tr class="info text-center">
                <th style="min-width: 140px;" class="text-center">所属分区<br>(网点)</th>
                <th style="min-width: 140px;" class="text-center">所属省份<br>(网点)</th>
                <th style="min-width: 140px;" class="text-center">所属城市<br>(网点)</th>
                <th style="min-width: 200px;" class="text-center">经销商名称</th>
                <th style="min-width: 140px;" class="text-center">配送类型</th>
                <th style="min-width: 120px;" class="text-center">网点编号</th>
                <th style="min-width: 200px;" class="text-center">网点名称</th>
                <th style="min-width: 140px;" class="text-center">联系人</th>
                <th style="min-width: 140px;" class="text-center">联系电话</th>
                <th style="min-width: 140px;" class="text-center">联系手机</th>
                <th style="min-width: 200px;" class="text-center">网点地址</th>
                <th style="min-width: 140px;" class="text-center">业务员</th>
                <th style="min-width: 140px;" class="text-center">网点类型</th>
                <th style="min-width: 140px;" class="text-center">网点等级</th>
            </tr>
            {volist name="data" id="row" key="k"}
            <tr>
                <td>{$row.zoning}</td>
                <td>{$row.provice}</td>
                <td>{$row.city}</td>
                <td>{$row.khmc}</td>
                <td>{$row.pslx}</td>
                <td>{$row.khbh}</td>
                <td>{$row.khmc}</td>
                <td>{$row.lxr}</td>
                <td>{$row.lxdh}</td>
                <td>{$row.lxsj}</td>
                <td>
                    <div align="center">{$row.wddz}</div>
                </td>
                <td>{$row.ywy}</td>
                <td>{$row.wdlx}</td>
                <td>{$row.wddj}</td>
            </tr>
            {/volist}
            <tfoot>
            <tr class="trTotal text-right">
                <td colspan="14">总计</td>
            </tr>
            </tfoot>
        </table>
        <h5 class="text-center">
            {$page}
        </h5>
    </form>
</div>
<!-- 全局js -->
<script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!--统计代码，可删除-->
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
<script src="__STATIC__/layout/js/common.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script>
    $(document).ready(function () {

        //弹出选择品牌
        $('#select_brand').on('click',function () {
            top.layer.open({
                type:2,
                area:['60%','60%'],
                maxmin:true,
                content:'{:url("open/brand")}',
                btn:['确定','取消'],
                yes:function (i,o) {
                    var a = $(o).find('iframe').contents()
                    var data = a.find('#data')
                    data = data.val()
                    data = JSON.parse(data)
                    var bool = false
                    for(var j=0;j<data.length;j++){
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).find('input').val() == data[j].id) {
                                bool = true;
                            }
                        })
                        if (bool == false)
                            $('#chanPin_selectIds').append('<span class="ren"><input type="hidden" name="txry[]" value="'+data[j].id+'">' + data[j].title + '<input type="hidden" name="area_id[]" value="' + data[j].id + '"><span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                    }

                    top.layer.close(i)
                }
            })
            return  false
        })

        $('#chanPin_selectIds').on('click','.close',function () {
            $(this).closest('.ren').remove()
        })

        $('[name=cpwd]').on('click', function () {
            $("#cp").bsSuggest('destroy')
            $('#select_brand').off('click')
            var val = $(this).val()
            $('#chanPin_selectIds').html('')
            switch (val) {
                case '2':
                    //产品品类
                    $("#cp").bsSuggest({
                        url: "{:url('bs/category')}",
                        /*effectiveFields: ["userName", "shortAccount"],
                         searchFields: [ "shortAccount"],*/
                        effectiveFieldsAlias: {title: "名称"},
                        ignorecase: true,
                        showHeader: true,
                        showBtn: false,     //不显示下拉按钮
                        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                        idField: "id",
                        keyField: "title",
                        clearable: true
                    }).on('onSetSelectValue', function (e, keyword, data) {
                        $(this).val('')
                        var bool = false
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).data('id') == keyword.id) {
                                bool = true;
                            }
                        })
                        if (bool == false) {
                            $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
                        }
                    });
                    //弹出选择品类
                    $('#select_brand').on('click',function () {
                        top.layer.open({
                            type:2,
                            area:['60%','60%'],
                            maxmin:true,
                            content:'{:url("open/category")}',
                            btn:['确定','取消'],
                            yes:function (i,o) {
                                var a = $(o).find('iframe').contents()
                                var data = a.find('#data')
                                data = data.val()
                                data = JSON.parse(data)
                                var bool = false
                                for(var j=0;j<data.length;j++){
                                    $('#chanPin_selectIds .ren').each(function (idx, o) {
                                        if ($(this).find('input').val() == data[j].id) {
                                            bool = true;
                                        }
                                    })
                                    if (bool == false)
                                        $('#chanPin_selectIds').append('<span class="ren">' + data[j].title + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                                }

                                top.layer.close(i)
                            }
                        })
                        return  false
                    })
                    break;
                case '3':
                    //系列
                    $("#cp").bsSuggest({
                        url: "{:url('bs/series')}",
                        /*effectiveFields: ["userName", "shortAccount"],
                         searchFields: [ "shortAccount"],*/
                        effectiveFieldsAlias: {title: "名称"},
                        ignorecase: true,
                        showHeader: true,
                        showBtn: false,     //不显示下拉按钮
                        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                        idField: "id",
                        keyField: "title",
                        clearable: true
                    }).on('onSetSelectValue', function (e, keyword, data) {
                        $(this).val('')
                        var bool = false
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).data('id') == keyword.id) {
                                bool = true;
                            }
                        })
                        if (bool == false) {
                            $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
                        }
                    });
                    //弹出选择系列
                    $('#select_brand').on('click',function () {
                        top.layer.open({
                            type:2,
                            area:['60%','60%'],
                            maxmin:true,
                            content:'{:url("open/series")}',
                            btn:['确定','取消'],
                            yes:function (i,o) {
                                var a = $(o).find('iframe').contents()
                                var data = a.find('#data')
                                data = data.val()
                                data = JSON.parse(data)
                                var bool = false
                                for(var j=0;j<data.length;j++){
                                    $('#chanPin_selectIds .ren').each(function (idx, o) {
                                        if ($(this).find('input').val() == data[j].id) {
                                            bool = true;
                                        }
                                    })
                                    if (bool == false)
                                        $('#chanPin_selectIds').append('<span class="ren"><input type="hidden" name="txry[]" value="'+data[j].id+'">' + data[j].title + '<input type="hidden" name="area_id[]" value="' + data[j].id + '"><span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                                }
                                top.layer.close(i)
                            }
                        })
                        return  false
                    })
                    break;
                case '4':
                    //SKU
                    $("#cp").bsSuggest({
                        url: "{:url('bs/sku')}",
                        /*effectiveFields: ["userName", "shortAccount"],
                         searchFields: [ "shortAccount"],*/
                        effectiveFieldsAlias: {title: "名称"},
                        ignorecase: true,
                        showHeader: true,
                        showBtn: false,     //不显示下拉按钮
                        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                        idField: "id",
                        keyField: "title",
                        clearable: true
                    }).on('onSetSelectValue', function (e, keyword, data) {
                        $(this).val('')
                        var bool = false
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).data('id') == keyword.id) {
                                bool = true;
                            }
                        })
                        if (bool == false) {
                            $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
                        }
                    });
                    //弹出选择sku
                    $('#select_brand').on('click',function () {
                        top.layer.open({
                            type:2,
                            area:['60%','60%'],
                            maxmin:true,
                            content:'{:url("open/sku")}',
                            btn:['确定','取消'],
                            yes:function (i,o) {
                                var a = $(o).find('iframe').contents()
                                var data = a.find('#data')
                                data = data.val()
                                data = JSON.parse(data)
                                var bool = false
                                for(var j=0;j<data.length;j++){
                                    $('#chanPin_selectIds .ren').each(function (idx, o) {
                                        if ($(this).find('input').val() == data[j].id) {
                                            bool = true;
                                        }
                                    })
                                    if (bool == false)
                                        $('#chanPin_selectIds').append('<span class="ren"><input type="hidden" name="txry[]" value="'+data[j].id+'">' + data[j].title + '<input type="hidden" name="area_id[]" value="' + data[j].id + '"><span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                                }
                                top.layer.close(i)
                            }
                        })
                        return  false
                    })
                    break;
                case '5':
                    //单品
                    $("#cp").bsSuggest({
                        url: "{:url('bs/products')}",
                        effectiveFields: ["id", "title"],
                        searchFields: ["title"],
                        effectiveFieldsAlias: {title: "名称"},
                        ignorecase: true,
                        showHeader: true,
                        showBtn: false,     //不显示下拉按钮
                        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                        idField: "id",
                        keyField: "title",
                        clearable: true
                    }).on('onSetSelectValue', function (e, keyword, data) {
                        $(this).val('')
                        var bool = false
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).data('id') == keyword.id) {
                                bool = true;
                            }
                        })
                        if (bool == false) {
                            $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
                        }
                    });
                    //弹出选择单品
                    $('#select_brand').on('click',function () {
                        top.layer.open({
                            type:2,
                            area:['60%','60%'],
                            maxmin:true,
                            content:'{:url("open/product")}',
                            btn:['确定','取消'],
                            yes:function (i,o) {
                                var a = $(o).find('iframe').contents()
                                var data = a.find('#data')
                                data = data.val()
                                data = JSON.parse(data)
                                var bool = false
                                for(var j=0;j<data.length;j++){
                                    $('#chanPin_selectIds .ren').each(function (idx, o) {
                                        if ($(this).find('input').val() == data[j].id) {
                                            bool = true;
                                        }
                                    })
                                    if (bool == false)
                                        $('#chanPin_selectIds').append('<span class="ren"><input type="hidden" name="txry[]" value="'+data[j].id+'">' + data[j].title + '<input type="hidden" name="area_id[]" value="' + data[j].id + '"><span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                                }
                                top.layer.close(i)
                            }
                        })
                        return  false
                    })
                    break;
                default:
                    //产品品牌搜索自动补全
                    $("#cp").bsSuggest({
                        url: "{:url('select/brandjson')}",
                        /*effectiveFields: ["userName", "shortAccount"],
                         searchFields: [ "shortAccount"],*/
                        effectiveFieldsAlias: {title: "名称"},
                        ignorecase: true,
                        showHeader: true,
                        showBtn: false,     //不显示下拉按钮
                        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
                        idField: "id",
                        keyField: "title",
                        clearable: true
                    }).on('onSetSelectValue', function (e, keyword, data) {
                        $(this).val('')
                        var bool = false
                        $('#chanPin_selectIds .ren').each(function (idx, o) {
                            if ($(this).data('id') == keyword.id) {
                                bool = true;
                            }
                        })
                        if (bool == false) {
                            $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
                        }
                    });
                    //弹出选择品牌
                    $('#select_brand').on('click',function () {
                        top.layer.open({
                            type:2,
                            area:['60%','60%'],
                            maxmin:true,
                            content:'{:url("open/brand")}',
                            btn:['确定','取消'],
                            yes:function (i,o) {
                                var a = $(o).find('iframe').contents()
                                var data = a.find('#data')
                                data = data.val()
                                data = JSON.parse(data)
                                var bool = false
                                for(var j=0;j<data.length;j++){
                                    $('#chanPin_selectIds .ren').each(function (idx, o) {
                                        if ($(this).find('input').val() == data[j].id) {
                                            bool = true;
                                        }
                                    })
                                    if (bool == false)
                                        $('#chanPin_selectIds').append('<span class="ren"><input type="hidden" name="txry[]" value="'+data[j].id+'">' + data[j].title + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+data[j].id+'"><input type="hidden" name="cpwd3[]" value="'+data[j].title+'"></span>')
                                }

                                top.layer.close(i)
                            }
                        })
                        return  false
                    })
                    break;
            }
        })
        //产品品牌搜索自动补全
        $("#cp").bsSuggest({
            url: "{:url('select/brandjson')}",
            /*effectiveFields: ["userName", "shortAccount"],
             searchFields: [ "shortAccount"],*/
            effectiveFieldsAlias: {title: "名称"},
            ignorecase: true,
            showHeader: true,
            showBtn: false,     //不显示下拉按钮
            delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
            idField: "id",
            keyField: "title",
            clearable: true
        }).on('onSetSelectValue', function (e, keyword, data) {
            $(this).val('')
            var bool = false
            $('#chanPin_selectIds .ren').each(function (idx, o) {
                if ($(this).data('id') == keyword.id) {
                    bool = true;
                }
            })
            if (bool == false) {
                $('#chanPin_selectIds').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span><input type="hidden" name="cpwd2[]" value="'+keyword.id+'"><input type="hidden" name="cpwd3[]" value="'+keyword.key+'"></span>')
            }
        });

        var $ObjectNum = $(".ObjectNum");
        toNum($ObjectNum);
    })
    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY-MM-DD',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
</script>
<script>
    $(".emptyIf").click(function () {
        cleanSearchMethod()
    });

    function cleanSearchMethod() {
        $("#empName").val('');
        $("#wangDianName").val('');
        $("#jinXiaoShanName").val('');
        $('#strArea').val('');
        $('#strCity').val('');
        $('#strProvince').val('');
        $("#start").val('');
        $("#end").val('');
        $("#peiSongType").val('');
        $("#chanPin_selectIds").html('');
    }
</script>
</body>

</html>
